<template>
  <div class="pad-content-box form-no-padding-box margin-top-20">
    <el-form label-width="100px" size="small" ref="sureForm" :model="searchParams">
      <el-row>
        <el-col :span="24">
          <el-form-item label="生效日期" prop="confirmDate" :rules="[{ required: true, message: '请输入', trigger:['change','blur']  }]">
            <el-date-picker 
              v-model="searchParams.confirmDate" 
              value-format="timestamp"
              placeholder="请选择"
              type="date"> 
            </el-date-picker>
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <el-form-item label="说明" prop="description">
            <el-input placeholder="请输入" type="textarea" v-model="searchParams.description" clearable></el-input>
          </el-form-item>
        </el-col>
      </el-row>
    </el-form>
    <div class="dialog-footer">
      <el-button @click="closeDialog({success:false})" size="small" class="el-button-reset">取 消</el-button>
      <el-button type="primary" size="small" @click="save()">确 定</el-button>
    </div>
  </div>
</template>

<script>
  import {apiBusinessContractSure} from '../../../api/gatherManage';
  export default {
    name: 'salesReport',
    props:{
      primaryKey:{
        type:String,
        default:()=>{
          return null
        }
      }
    },
    data() {
      return {
        searchParams:{}
      };
    },
    created() {
    },
    methods: {
      save(){
        this.$refs.sureForm.validate(async valid => {
          if (valid) {
            await apiBusinessContractSure({...this.searchParams,primaryKey:this.primaryKey})
            this.closeDialog({success:true})
          }
        });
      },
      closeDialog(data){
        this.$emit('closeDialog',data)
        this.searchParams = {}
      }
    },
  };
</script>

<style lang="scss" scoped>
  ::v-deep .has-tab-header-border .el-tabs__header {
    border: none;
  }
  ::v-deep .cell{
    text-align: center;
  }
  .dialog-footer{
    display: flex;
    justify-content: flex-end;
    margin-top:30px;
  }
</style>
